package example.com.dagger2.subcomponentdemo;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import example.com.dagger2.R;

/**
 * Created by Asura on 2016/7/27.
 */
public class SecondActivity extends AppCompatActivity {
    //生命周期自己把控
    private SecondActivityComponent secondActivityComponent;


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.second_activity);
        secondActivityComponent = DaggerSecondActivityComponent.builder().build();
        getSupportFragmentManager().beginTransaction().replace(R.id.main, new ChildFragment()).commit();
    }

    public SecondActivityComponent getSecondActivityComponent() {
        return secondActivityComponent;
    }


}
